﻿/// <reference path="_namespace.js" />
/// <reference path="../../drawing/Timer.js" />
/// <reference path="../../collections/Comparer.js"/>

/*****************************************************************************
Ajaxna library Interface definition.
Author: krobinson 10/13/2008 4:09:46 PM.
Class:  ajax.xna.framework.IDrawable
*****************************************************************************/

$addNamespace("ajax.xna.framework");
//-----------------------------------------------------------------------------

ajax.xna.framework.IDrawable = function()
{///<summary>defines the interface for a drawable game component.</summary>
}; // ctor should be blank.
$extend("ajax.xna.framework.IDrawable", ""); // You may also inherit from another interface.
//-----------------------------------------------------------------------------

// Public members
//-----------------------------------------------------------------------------

// Public Methods
//-----------------------------------------------------------------------------
ajax.xna.framework.IDrawable.prototype.get_drawOrder = function() 
{///<summary>The order in which to draw this object relative to other objects. Objects with lower values are drawn first.</summary>
 ///<returns type="int" integer="true">Order in which to draw this object relative to other objects.</returns>
};
ajax.xna.framework.IDrawable.prototype.add_drawOrderChanged = function(handler)
{///<summary>Adds a handler to event raised when the IDrawable.get_drawOrder() property changes.</summary>
}
ajax.xna.framework.IDrawable.prototype.remove_drawOrderChanged = function(handler)
{///<summary>Removes a handler to event raised when the IDrawable.get_drawOrder() property changes.</summary>
}
//-----------------------------------------------------------------------------


ajax.xna.framework.IDrawable.prototype.get_visible = function()
{///<summary>Indicates whether IDrawable.draw() should be called in Game.draw() for this game component.</summary>
 ///<returns type="bool">true if IDrawable.draw() should be called; false otherwise.</returns>
}

ajax.xna.framework.IDrawable.prototype.add_visibleChanged = function(handler)
{///<summary>Adds a handler to event raised when the IDrawable.get_visible() property changes.</summary>
}
ajax.xna.framework.IDrawable.prototype.remove_visibleChanged = function(handler)
{///<summary>Removes a handler to event raised when the IDrawable.get_visible() property changes.</summary>
}
//-----------------------------------------------------------------------------

ajax.xna.framework.IDrawable.prototype.draw = function(gameTime)
{///<summary>Draws the IDrawable.</summary>
 ///<param name="gameTime" type="ajax.drawing.Timer">Snapshot of the game's timing state.</param>
}

// Statics
//-----------------------------------------------------------------------------
ajax.xna.framework.IDrawable.cast = function(obj)
{///<returns type="ajax.xna.framework.IDrawable"/>
    return obj;
}


// Comparer object
//-----------------------------------------------------------------------------
ajax.xna.framework.IDrawable.Comparer = function()
{
}
$extend("ajax.xna.framework.IDrawable.Comparer", "ajax.collections.Comparer");
if ($getDesignMode())
    ajax.xna.framework.IDrawable.Comparer.prototype = ajax.collections.Comparer.prototype;

ajax.xna.framework.IDrawable.Comparer.prototype.compare = function(a, b)
{///<param name="a" type="ajax.xna.framework.IDrawable"/>
 ///<param name="b" type="ajax.xna.framework.IDrawable"/>     
    if (a.get_drawOrder() < b.get_drawOrder())
        return -1;
    else if (GetObject.get_drawOrder() > b.get_drawOrder())
        return 1;
    return 0;
}